<?php


namespace apps\marriage\core\model;


use vm\com\BaseModel;

class UserAccountBook extends BaseModel
{
    const OP_INCREASE = 1;
    const OP_DECREASE = 0;

    const MONEY_TYPE_MONEY = 10;        // 人民币
    const MONEY_TYPE_GOLD_COIN = 20;    // 金币

    const IID_TYPE_VIP_LEVEL = 5;               // 购买会员
    const IID_TYPE_UNLOCK_MEMBER_PHONE = 10;    // 解锁手机号
    const IID_TYPE_UNLOCK_MEMBER_WXID = 20;     // 解锁微信号
    const IID_TYPE_FACEID_DETECT = 30;          // 实名认证/人脸核身
    const IID_TYPE_ACTIVITY = 40;               // 参加活动
    const IID_TYPE_UNLOCK_CHAT_SESSION = 50;    // 聊天对话
    const IID_TYPE_COURSE = 60;                 // 参加课程
    const IID_TYPE_WITHDRAW_CASH = 70;          // 提现
    const IID_TYPE_SERVICE_PACKAGE = 80;    // 购买服务套餐

    public function sumAmount($userId, $op)
    {
        $amount = $this->where('op', $op)->where('user_id', $userId)->sum('amount');
        return $amount;
    }
}